home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1997 August / Macworld (1997-08).dmg / Shareware World / Info / For Developers / SC Basic / Example Programs / Dos To Mac / DosToMac.bas < prev    next >
BASIC Source File  |  1997-06-17  |  2KB  |  90 lines

  1. Global FSSpec1 As Structure
  2.         Global vRefNum1 As Word
  3.         Global parID1 As Integer
  4.         Global name1 As Str255[63]
  5. Endstruct
  6.  
  7. Global FSSpec2 As Structure
  8.         Global vRefNum2 As Word
  9.         Global parID2 As Integer
  10.         Global name2 As Str255[63]
  11. Endstruct
  12.  
  13. Do Display_File_Select_Boxes
  14. Do Initialise
  15. Do Process_Files
  16. Do Cleanup
  17. End
  18.  
  19. *********************************************************
  20. *                                                                                                                                                                                                                            *
  21. *    Display File Select Boxes                                                                                                                                    *
  22. *********************************************************
  23. Procedure Display_File_Select_Boxes()
  24. Local Reply As Structure
  25.     Local sfGood As Byte
  26.     Local sfReplacing As Byte
  27.     Local sfType As Integer
  28.     Local sfFile As Char[70]
  29.     Local sfScript As Word
  30.     Local sfFlags As Word
  31.     Local sfIsFolder As Byte
  32.     Local sfIsVolume As Byte
  33.     Local sfReserved1 As Integer
  34.     Local sfReserved2 As Word
  35. Endstruct
  36.  
  37.     _StandardGetFile(0,Word(1),Char("TEXT"),Reply)
  38.     If Integer(sfGood)=0
  39.                 End
  40.         Else
  41.         FSSpec1=sfFile
  42.     Endif
  43.  
  44.     _StandardPutFile(Str255("Name of file to save"),Str255("Mac.out"),Reply)    
  45.     If Integer(sfGood)=0
  46.                 End
  47.         Else
  48.         FSSpec2=sfFile
  49.     Endif
  50. Return
  51.  
  52. *********************************************************
  53. *                                                                                                                                                                                                                            *
  54. *    Initialise                                                                                                                  *
  55. *********************************************************
  56. Procedure Initialise()
  57.  
  58.         FSOpen FSSpec1 For Input As #1
  59.         FSOpen FSSpec2 For Output As #2    
  60.  
  61. Return
  62.  
  63. *********************************************************
  64. *                                                                                                                                                                                                                            *
  65. *    Process Files                                                                                                           *
  66. *********************************************************
  67. Procedure Process_Files()
  68. Local TempString As String [255]
  69. Local FirstChar As Integer
  70.  
  71.         Repeat
  72.                 Line Input #1,TempString
  73.                 FirstChar=Asc(Left(TempString,1))
  74.                 If FirstChar=10 ' Line Feed
  75.                         TempString=Right(TempString,Len(TempString)-1)
  76.                 Endif        
  77.                 Print #2,TempString
  78.         Until Eof(1)
  79. Return    
  80.  
  81. *********************************************************
  82. *                                                                                                                                                                                                                            *
  83. *    Cleanup                                                                                                                            *
  84. *********************************************************    
  85. Procedure Cleanup()
  86.  
  87.         Close #1
  88.         Close #2
  89. Return
  90.